--[[
    Zacznijmy wiecej wymagac ~Xyrusek
    AUTOR: Xyrusek    
--]]


--[[
    SKALOWANIE    
--]]

local sx, sy = guiGetScreenSize() 
local zoom = sx < 1920 and math.min(2, 1920 / sx) or 1

--[[
    KOD    
--]]

local t = {}
    t[1] = dxCreateTexture("files/najman.png", "argb", true, "clamp")

local najmans = {}
    najmans[#najmans+1] = {
        position = {2781.47, -1811.26, 15.84, 2795.85, -1815.26, 21.84},
    }

function renderNajman()
    for i, v in ipairs(najmans) do
        local x, y, z, x1, y1, z1 = unpack(v.position)
        dxDrawMaterialLine3D(x, y, z+5.5, x, y, z-5.5, t[1], 5.25, tocolor(255, 255, 255), x1, y1+5, z1)
    end
end

for i, v in ipairs(najmans) do
    local x, y = unpack(v.position)
    v.cuboid = createColCircle(x, y, 50)
    addEventHandler("onClientColShapeHit", v.cuboid, function(hit, md)
        if not hit or not md or hit ~= localPlayer then return false end
        removeEventHandler("onClientRender", getRootElement(), renderNajman)
        addEventHandler("onClientRender", getRootElement(), renderNajman)
    end)
    addEventHandler("onClientColShapeLeave", v.cuboid, function(hit, md)
        if not hit or not md or hit ~= localPlayer then return false end
        removeEventHandler("onClientRender", getRootElement(), renderNajman)
    end)
end

function clearTextures()
    for i, v in ipairs(t) do if isElement(v) then destroyElement(v) end end
end
addEventHandler("onClientResourceStop", getResourceRootElement(), clearTextures)